package vg.services.user_interface_manager.additional_swing_components;

import java.awt.event.ActionListener;

import javax.swing.JComboBox;
import javax.swing.JComponent;

/**
 * This class realizes zoom combobox.
 * @author dkolbin
 */

public class ZoomComboBox {
	// Don't use JComboBox<String>, because need compatibility with JDK 6
	private JComboBox zoomCombo;
	
	public ZoomComboBox() {
		zoomCombo = new JComboBox();
		
		zoomCombo.addItem("400%");
		zoomCombo.addItem("200%");
		zoomCombo.addItem("100%");
		zoomCombo.addItem("50%");
		zoomCombo.addItem("25%");
		zoomCombo.addItem("Actual size");

		zoomCombo.setEnabled(false);
		zoomCombo.setSelectedIndex(2);
		zoomCombo.setEditable(true);
		zoomCombo.setMaximumSize(zoomCombo.getPreferredSize());
	}
	public void addActionListener(ActionListener l)
	{
		zoomCombo.addActionListener(l);		
	}
	
	public String getScale()
	{
		return zoomCombo.getSelectedItem().toString();
	}
	
	public void setSelectedItem(Object anObject)
	{
		zoomCombo.setSelectedItem(anObject);
	}
	/**
	 * This method adds hint to zoom combo box.
	 */
	public void setToolTipText(String text) {
		this.zoomCombo.setToolTipText(text);
	}
	
	public JComponent getView() {
		return zoomCombo;
	}

	public void enable() {
		zoomCombo.setEnabled(true);
	}

	public void disable() {
		zoomCombo.setEnabled(false);

	}

	public boolean isActive() {
		// TODO Auto-generated method stub
		return false;
	}
	
	public void run(Object obj) {
	
	}
}
